namespace ext.grid
{
	using System;
	using System.Runtime.CompilerServices;
	using System.Html;
	using System.Collections;
	
	
	/// <summary>
	/// The PivotGrid component enables rapid summarization of large data sets. It provides a way to reduce a large set of
	/// data down into a format where trends and insights become more apparent. A classic example is in sales data; a company
	/// will often have a record of all sales it makes for a given period - this will often encompass thousands of rows of
	/// data. The PivotGrid allows you to see how well each salesperson performed, which cities generate the most revenue,
	/// how products perform between cities and so on.  A PivotGrid is composed of two axes (left and top), one {@link #measure} and one {@link #aggregator aggregation}
	/// function. Each axis can contain one or more {@link #dimension}, which are ordered into a hierarchy. Dimensions on the
	/// left axis can also specify a width. Each dimension in each axis can specify its sort ordering, defaulting to &quot;ASC&quot;,
	/// and must specify one of the fields in the {@link Ext.data.Record Record} used by the PivotGrid&apos;s
	/// {@link Ext.data.Store Store}.  
	/// ..
	/// </summary>
	/// <htmlSummary>
	/// &lt;p&gt;The PivotGrid component enables rapid summarization of large data sets. It provides a way to reduce a large set of
	/// data down into a format where trends and insights become more apparent. A classic example is in sales data; a company
	/// will often have a record of all sales it makes for a given period - this will often encompass thousands of rows of
	/// data. The PivotGrid allows you to see how well each salesperson performed, which cities generate the most revenue,
	/// how products perform between cities and so on.&lt;/p&gt;
	/// &lt;p&gt;A PivotGrid is composed of two axes (left and top), one {@link #measure} and one {@link #aggregator aggregation}
	/// function. Each axis can contain one or more {@link #dimension}, which are ordered into a hierarchy. Dimensions on the
	/// left axis can also specify a width. Each dimension in each axis can specify its sort ordering, defaulting to &quot;ASC&quot;,
	/// and must specify one of the fields in the {@link Ext.data.Record Record} used by the PivotGrid&apos;s
	/// {@link Ext.data.Store Store}.&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// // This is the record representing a single sale
	/// var SaleRecord = Ext.data.Record.create([
	/// {name: &apos;person&apos;, type: &apos;string&apos;},
	/// {name: &apos;product&apos;, type: &apos;string&apos;},
	/// {name: &apos;city&apos;, type: &apos;string&apos;},
	/// {name: &apos;state&apos;, type: &apos;string&apos;},
	/// {name: &apos;year&apos;, type: &apos;int&apos;},
	/// {name: &apos;value&apos;, type: &apos;int&apos;}
	/// ]);
	///
	/// // A simple store that loads SaleRecord data from a url
	/// var myStore = new Ext.data.Store({
	/// url: &apos;data.json&apos;,
	/// autoLoad: true,
	/// reader: new Ext.data.JsonReader({
	/// root: &apos;rows&apos;,
	/// idProperty: &apos;id&apos;
	/// }, SaleRecord)
	/// });
	///
	/// // Create the PivotGrid itself, referencing the store
	/// var pivot = new Ext.grid.PivotGrid({
	/// store : myStore,
	/// aggregator: &apos;sum&apos;,
	/// measure : &apos;value&apos;,
	///
	/// leftAxis: [
	/// {
	/// width: 60,
	/// dataIndex: &apos;product&apos;
	/// },
	/// {
	/// width: 120,
	/// dataIndex: &apos;person&apos;,
	/// direction: &apos;DESC&apos;
	/// }
	/// ],
	///
	/// topAxis: [
	/// {
	/// dataIndex: &apos;year&apos;
	/// }
	/// ]
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;The specified {@link #measure} is the field from SaleRecord that is extracted from each combination
	/// of product and person (on the left axis) and year on the top axis. There may be several SaleRecords in the
	/// data set that share this combination, so an array of measure fields is produced. This array is then
	/// aggregated using the {@link #aggregator} function.&lt;/p&gt;
	/// &lt;p&gt;The default aggregator function is sum, which simply adds up all of the extracted measure values. Other
	/// built-in aggregator functions are count, avg, min and max. In addition, you can specify your own function.
	/// In this example we show the code used to sum the measures, but you can return any value you like. See
	/// {@link #aggregator} for more details.&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// new Ext.grid.PivotGrid({
	/// aggregator: function(records, measure) {
	/// var length = records.length,
	/// total = 0,
	/// i;
	///
	/// for (i = 0; i &lt; length; i++) {
	/// total += records[i].get(measure);
	/// }
	///
	/// return total;
	/// },
	///
	/// renderer: function(value) {
	/// return Math.round(value);
	/// },
	///
	/// //your normal config here
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;&lt;u&gt;Renderers&lt;/u&gt;&lt;/p&gt;
	/// &lt;p&gt;PivotGrid optionally accepts a {@link #renderer} function which can modify the data in each cell before it
	/// is rendered. The renderer is passed the value that would usually be placed in the cell and is expected to return
	/// the new value. For example let&apos;s imagine we had height data expressed as a decimal - here&apos;s how we might use a
	/// renderer to display the data in feet and inches notation:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// new Ext.grid.PivotGrid({
	/// //in each case the value is a decimal number of feet
	/// renderer : function(value) {
	/// var feet = Math.floor(value),
	/// inches = Math.round((value - feet) * 12);
	///
	/// return String.format(&quot;{0}&apos; {1}\&quot;&quot;, feet, inches);
	/// },
	/// //normal config here
	/// });
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;&lt;u&gt;Reconfiguring&lt;/u&gt;&lt;/p&gt;
	/// &lt;p&gt;All aspects PivotGrid&apos;s configuration can be updated at runtime. It is easy to change the {@link #setMeasure measure},
	/// {@link #setAggregator aggregation function}, {@link #setLeftAxis left} and {@link #setTopAxis top} axes and refresh the grid.&lt;/p&gt;
	/// &lt;p&gt;In this case we reconfigure the PivotGrid to have city and year as the top axis dimensions, rendering the average sale
	/// value into the cells:&lt;/p&gt;
	/// &lt;pre&gt;&lt;code&gt;
	/// //the left axis can also be changed
	/// pivot.topAxis.setDimensions([
	/// {dataIndex: &apos;city&apos;, direction: &apos;DESC&apos;},
	/// {dataIndex: &apos;year&apos;, direction: &apos;ASC&apos;}
	/// ]);
	///
	/// pivot.setMeasure(&apos;value&apos;);
	/// pivot.setAggregator(&apos;avg&apos;);
	///
	/// pivot.view.refresh(true);
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;p&gt;See the {@link Ext.grid.PivotAxis PivotAxis} documentation for further detail on reconfiguring axes.&lt;/p&gt;
	/// </htmlSummary>
	/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
	[ScriptName("PivotGrid")]
	[ScriptNamespace("Ext.grid")]
	[Imported()]
	public partial class PivotGrid : ext.grid.GridPanel
	{
		
		#region Constructors
		public PivotGrid(ext.grid.PivotGrid_Configuration config)
		{
		}
		
		/// <summary>Constructor</summary>
		public PivotGrid()
		{
		}
		#endregion
		
		#region Fields
		/// <summary>
		/// The aggregation function to use to combine the measures extracted
		/// for each dimension combination. Can be any of the built-in aggregators (sum, count, avg, min, max).
		/// Can also be a function which accepts two arguments (an array of Records to aggregate, and the measure
		/// to aggregate them on) and should return a String.
		/// </summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("aggregator")]
		public ext.auto.System_String_Or_System_Delegate Aggregator;
		
		/// <summary>
		/// Optional renderer to pass values through before they are rendered to the dom. This
		/// gives an opportunity to modify cell contents after the value has been computed.
		/// </summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("renderer")]
		public System.Delegate Renderer;
		
		/// <summary>
		/// The field to extract from each Record when pivoting around the two axes. See the class
		/// introduction docs for usage
		/// </summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("measure")]
		public string Measure;
		
		/// <summary>
		/// Either and array of {@link #dimension} to use on the left axis, or
		/// a {@link Ext.grid.PivotAxis} instance. If an array is passed, it is turned into a PivotAxis internally.
		/// </summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("leftAxis")]
		public ext.auto.System_Array_Or_ext_grid_PivotAxis LeftAxis;
		
		/// <summary>
		/// Either and array of {@link #dimension} to use on the top axis, or
		/// a {@link Ext.grid.PivotAxis} instance. If an array is passed, it is turned into a PivotAxis internally.
		/// </summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("topAxis")]
		public ext.auto.System_Array_Or_ext_grid_PivotAxis TopAxis;
		#endregion
		
		#region Properties
		/// <summary>The configured {@link Ext.grid.PivotAxis} used as the left Axis for this Pivot Grid</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("leftAxis")]
		[IntrinsicProperty()]
		public ext.grid.PivotAxis LeftAxisProperty
		{
			get
			{
				throw new System.Exception("Imported - not implemented");
			}
			set
			{
			}
		}
		
		/// <summary>The configured {@link Ext.grid.PivotAxis} used as the top Axis for this Pivot Grid</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		[ScriptName("topAxis")]
		[IntrinsicProperty()]
		public ext.grid.PivotAxis TopAxisProperty
		{
			get
			{
				throw new System.Exception("Imported - not implemented");
			}
			set
			{
			}
		}
		#endregion
		
		#region Methods
		/// <summary>Returns the function currently used to aggregate the records in each Pivot cell</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <returns>The current aggregator function</returns>
		[ScriptName("getAggregator")]
		public System.Function GetAggregator()
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Sets the field name to use as the Measure in this Pivot Grid</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <param name="measure">The field to make the measure</param>
		[ScriptName("setMeasure")]
		public void SetMeasure(string measure)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Sets the left axis of this pivot grid. Optionally refreshes the grid afterwards.</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <param name="axis">The pivot axis</param>
		/// <param name="refresh">True to immediately refresh the grid and its axes (defaults to false)</param>
		[ScriptName("setLeftAxis")]
		public void SetLeftAxis(ext.grid.PivotAxis axis, bool refresh)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Sets the top axis of this pivot grid. Optionally refreshes the grid afterwards.</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <param name="axis">The pivot axis</param>
		/// <param name="refresh">True to immediately refresh the grid and its axes (defaults to false)</param>
		[ScriptName("setTopAxis")]
		public void SetTopAxis(ext.grid.PivotAxis axis, bool refresh)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Returns the grid&apos;s GridView object.</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <returns>The grid view</returns>
		[ScriptName("getView")]
		public ext.grid.PivotGridView GetView()
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Sets the function to use when aggregating data for each cell.</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <param name="aggregator">The new aggregator function or named function string</param>
		[ScriptName("setAggregator")]
		public void SetAggregator(string aggregator)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>Sets the function to use when aggregating data for each cell.</summary>
		/// <definedin>src\widgets\grid\PivotGrid.js</definedin>
		/// <param name="aggregator">The new aggregator function or named function string</param>
		[ScriptName("setAggregator")]
		public void SetAggregator(System.Delegate aggregator)
		{
			throw new System.Exception("Imported - not implemented");
		}
		#endregion
	}
}
